<?php

use Illuminate\Database\Migrations\Migration;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Support\Facades\Schema;

class CreateAdminLogsTable extends Migration
{
    /**
     * Run the migrations.
     *
     * @return void
     */
    public function up()
    {
        Schema::create('admin_logs', function (Blueprint $table) {
            $table->uuid('id');
            $table->integer('admin_id')->default(0)->comment('管理员id');
            $table->string('admin_ip', 25)->default('')->comment('管理员ip');
            $table->text('so_info')->nullable()->comment('操作信息');
            // 0默认操作日志（添加、修改、删除，查看除外），1登录登出日志，2异常日志。
            $table->tinyInteger('so_type')->default(0)->comment('日志类型');
            $table->timestamp('created_at', 0)->nullable()->useCurrent()->comment('创建时间');
        });
    }

    /**
     * Reverse the migrations.
     *
     * @return void
     */
    public function down()
    {
        Schema::dropIfExists('admin_logs');
    }
}
